package com.softserveinc.interactive_board.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;


@Entity
@Table(name = UserType.TABLE_NAME)
public class UserType {
	
	
	public static final String TABLE_NAME = "user_type";
	public static final String ID_COLUMN_NAME = "user_type_id";
	public static final String TYPE_COLUMN_NAME = "type";
	public static final String ROLE_COLUMN_NAME = "role";
	
	public static final int COLUMNS_MAX_LENGTH = 20;

	public static final int ID_ADMIN = 0;
	public static final int ID_PRESENTOR = 1;
	public static final int ID_STUDENT = 2;
	public static final int ID_ANONYMOUS = 3;

	public static final String ROLE_ADMIN = "ROLE_ADMIN";
	public static final String ROLE_PRESENTOR = "ROLE_PRESENTOR";
	public static final String ROLE_STUDENT = "ROLE_STUDENT";
	public static final String ROLE_ANONYMOUS = "ROLE_ANONYMOUS";

	public static final String TYPE_ADMIN = "admin";
	public static final String TYPE_PRESENTOR = "presentor";
	public static final String TYPE_STUDENT = "student";
	public static final String TYPE_ANONYMOUS = "guest";
	
	public static final int ID_MIN_VALUE = 0;
	public static final int ID_MAX_VALUE = 3;

	
	@Id
	@Column(name = UserType.ID_COLUMN_NAME)
	private Integer id;

	@Column(name = UserType.TYPE_COLUMN_NAME, length = UserType.COLUMNS_MAX_LENGTH)
	public String type;

	@Column(name = UserType.ROLE_COLUMN_NAME, length = UserType.COLUMNS_MAX_LENGTH)
	public String role;

	public UserType(Integer id, String type, String role) {
		this.id = new Integer(id);
		this.type = type;
		this.role = role;
	}
	
	public UserType(Integer id) {
		this(id, "type", "role");
	}

	public UserType() {
		this(UserType.ID_STUDENT, UserType.TYPE_STUDENT, UserType.ROLE_STUDENT);
	}


	public Integer getId() {
		return id;
	}


	public void setId(Integer id) {
		this.id = id;
	}


	public String getType() {
		return type;
	}


	public void setType(String type) {
		this.type = type;
	}

	public String getRole() {
		return role;
	}

	public void setRole(String role) {
		this.role = role;
	}

}
